import { Component, ChangeDetectionStrategy } from '@angular/core';
// import {TranslateService} from 'ng2-translate/ng2-translate';


@Component({
    selector: 'translate',
    changeDetection: ChangeDetectionStrategy.OnPush,
    template: `
        <br>
        <br>
        <br>
        <button (click)="changeLang('en-us')">英文</button>
        <button (click)="changeLang('zh-cn')">中文</button>
        <br>
        HELLO
        <h1>{{ 'HELLO' | translate:{value: param} }}</h1>
        <div [innerHTML]="'HELLO' | T"></div>
        <p>下面我使用T</p>
        {{'copyright'|T}}
        <select #langSelect (change)="translate.use(langSelect.value)">
          <option *ngFor="let lang of translate.getLangs()" [value]="lang" [selected]="lang === translate.currentLang">{{ lang }}</option>
        </select>
    `,
})

export class TranslateComponent {
    param: string = "world";

    // userLang: string = "en";

    constructor(
        // public translate: TranslateService
        ) {
    //     translate.addLangs(["en-us", "zh-cn"]);
    //    // this language will be used as a fallback when a translation isn't found in the current language
    //     translate.setDefaultLang('en-us');
 
    //      // the lang to use, if the lang isn't available, it will use the current loader to get them
    //     translate.setTranslation('en-us',enResource);
    //     translate.setTranslation('zh-cn',cnResource);
    //     translate.use('en-us');
        

    }

    changeLang(userLang) {
        // the lang to use, if the lang isn't available, it will use the current loader to get them
        // this.translate.use(userLang);
    }
}
